package com.example.springboottest.bean.util;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;

import java.util.Date;
import java.util.Objects;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class IsoConfigInfoPO {
    @Id
    private Integer id;
    /**
     * 根root节点
     */
    private String topRoot;
    /**
     * 当前节点名称
     */
    private String routeid;
    /**
     * 当前节点属于的root节点，如head or  body
     */
    private String rootNode;
    /**
     * 当前节点的父节点
     */
    private String parentNode;
    /**
     * 当前节点是否已被删除0 否 1 是
     */
    private Integer isDelete;
    /**
     * 当前节点属于什么请求类型的如pacs008
     */
    private String type;
    private Date createTime;
    private String createUser;
    /**
     * 当前节点的深度
     */
    private Integer deepRow;

    /**
     * 重写equals 和hashcode 方法，用来去重
     *
     * @param o
     * @return
     */
    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        IsoConfigInfoPO that = (IsoConfigInfoPO) o;
        return Objects.equals(topRoot, that.topRoot) && Objects.equals(routeid, that.routeid) && Objects.equals(rootNode, that.rootNode) && Objects.equals(parentNode, that.parentNode) && Objects.equals(type, that.type);
    }

    @Override
    public int hashCode() {
        return Objects.hash(topRoot, routeid, rootNode, parentNode, type);
    }

    @Override
    public String toString() {
        return "IsoConfigInfoPO{" +
                "topRoot='" + topRoot + '\'' +
                ", routeid='" + routeid + '\'' +
                ", rootNode='" + rootNode + '\'' +
                ", parentNode='" + parentNode + '\'' +
                '}';
    }
}
